//
//  TTabbar.m
//  tristana
//
//  Created by 李康 on 2021/1/5.
//  Copyright © 2021 李康. All rights reserved.
//

#import "TTabbar.h"

@implementation TTabbar

- (instancetype)init{
    if (self = [super init]){
        [self initMainView];
    }
    return self;
}

- (void)initMainView{
    _centerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    UIImage *normalImage = [UIImage imageNamed:@"tab_local"];
    _centerBtn.frame = CGRectMake(0, 0, normalImage.size.width, normalImage.size.height);
    [_centerBtn setImage:normalImage forState:UIControlStateNormal];
    _centerBtn.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width - normalImage.size.width)/2.0, - normalImage.size.height/3.0, normalImage.size.width, normalImage.size.height);
    
    [self addSubview:_centerBtn];
    
}

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
    UIView *view = [super hitTest:point withEvent:event];
    if (view == nil){
        //转换坐标
        CGPoint tempPoint = [self.centerBtn convertPoint:point fromView:self];
        if (CGRectContainsPoint(self.centerBtn.bounds, tempPoint)){
            return _centerBtn;
        }
    }
    return view;
}


@end
